package edu.unf.cen6940.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllGeneratedproducts", query = "select myGeneratedproduct from Generatedproduct myGeneratedproduct"),
		@NamedQuery(name = "findGeneratedproductByGeneratedProductId", query = "select myGeneratedproduct from Generatedproduct myGeneratedproduct where myGeneratedproduct.generatedProductId = ?1"),
		@NamedQuery(name = "findGeneratedproductByPrimaryKey", query = "select myGeneratedproduct from Generatedproduct myGeneratedproduct where myGeneratedproduct.generatedProductId = ?1"),
		@NamedQuery(name = "findGeneratedproductByProductDescription", query = "select myGeneratedproduct from Generatedproduct myGeneratedproduct where myGeneratedproduct.productDescription = ?1"),
		@NamedQuery(name = "findGeneratedproductByProductDescriptionContaining", query = "select myGeneratedproduct from Generatedproduct myGeneratedproduct where myGeneratedproduct.productDescription like ?1"),
		@NamedQuery(name = "findGeneratedproductByProductName", query = "select myGeneratedproduct from Generatedproduct myGeneratedproduct where myGeneratedproduct.productName = ?1"),
		@NamedQuery(name = "findGeneratedproductByProductNameContaining", query = "select myGeneratedproduct from Generatedproduct myGeneratedproduct where myGeneratedproduct.productName like ?1") })
@Table(catalog = "ThesisManagement", name = "GeneratedProduct")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "rms_test/edu/unf/cen6940/domain", name = "Generatedproduct")
public class Generatedproduct implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "generatedProductID", nullable = false)
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer generatedProductId;
	/**
	 */

	@Column(name = "productName", length = 100, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String productName;
	/**
	 */

	@Column(name = "productDescription", length = 1024, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String productDescription;

	/**
	 */
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(catalog = "ThesisManagement", name = "ThesisToGeneratedProduct", joinColumns = { @JoinColumn(name = "generatedProductID", referencedColumnName = "generatedProductID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "thesisID", referencedColumnName = "thesisID", nullable = false, updatable = false) })
	@XmlElement(name = "", namespace = "")
	java.util.Set<edu.unf.cen6940.domain.Thesis> thesises;

	/**
	 */
	public void setGeneratedProductId(Integer generatedProductId) {
		this.generatedProductId = generatedProductId;
	}

	/**
	 */
	public Integer getGeneratedProductId() {
		return this.generatedProductId;
	}

	/**
	 */
	public void setProductName(String productName) {
		this.productName = productName;
	}

	/**
	 */
	public String getProductName() {
		return this.productName;
	}

	/**
	 */
	public void setProductDescription(String productDescription) {
		this.productDescription = productDescription;
	}

	/**
	 */
	public String getProductDescription() {
		return this.productDescription;
	}

	/**
	 */
	public void setThesises(Set<Thesis> thesises) {
		this.thesises = thesises;
	}

	/**
	 */
	public Set<Thesis> getThesises() {
		if (thesises == null) {
			thesises = new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>();
		}
		return thesises;
	}

	/**
	 */
	public Generatedproduct() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Generatedproduct that) {
		setGeneratedProductId(that.getGeneratedProductId());
		setProductName(that.getProductName());
		setProductDescription(that.getProductDescription());
		setThesises(new java.util.LinkedHashSet<edu.unf.cen6940.domain.Thesis>(that.getThesises()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("generatedProductId=[").append(generatedProductId).append("] ");
		buffer.append("productName=[").append(productName).append("] ");
		buffer.append("productDescription=[").append(productDescription).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((generatedProductId == null) ? 0 : generatedProductId.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Generatedproduct))
			return false;
		Generatedproduct equalCheck = (Generatedproduct) obj;
		if ((generatedProductId == null && equalCheck.generatedProductId != null) || (generatedProductId != null && equalCheck.generatedProductId == null))
			return false;
		if (generatedProductId != null && !generatedProductId.equals(equalCheck.generatedProductId))
			return false;
		return true;
	}
}
